package com.stylefeng.guns.modular.vpn_operation_log.controller;

import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.vpn_operation_log.service.IVpnOperationLogService;

/**
 * 操作日志控制器
 *
 * @author fengshuonan
 * @Date 2020-04-20 16:00:08
 */
@Controller
@RequestMapping("/vpnOperationLog")
public class VpnOperationLogController extends BaseController {

    private String PREFIX = "/vpn_operation_log/vpnOperationLog/";

    @Autowired
    private IVpnOperationLogService vpnOperationLogService;

    /**
     * 跳转到操作日志首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "vpnOperationLog.html";
    }

    /**
     * 获取操作日志列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(@RequestParam(name = "page",defaultValue = "1") Integer page,
                       @RequestParam(name = "limit",defaultValue = "20") Integer limit) {
        return vpnOperationLogService.findOperationLogs(page,limit);
    }

    /**
     * 操作日志详情
     */
    @RequestMapping(value = "/detail/{vpnOperationLogId}")
    @ResponseBody
    public Object detail(@PathVariable("vpnOperationLogId") Integer vpnOperationLogId) {
        return vpnOperationLogService.selectById(vpnOperationLogId);
    }
}
